package cn.gson.crmdemo.model.dao;

import cn.gson.crmdemo.model.Permission;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionDao extends CrudRepository<Permission,Long> {
    /**
     * 查找根节点
     * @return
     */
    List<Permission> findAllByParentIsNull();

    /**
     * 查找子节点
     * @param permission
     * @return
     */
    List<Permission> findAllByParent(Permission permission);
}
